package org.example.guide.service;

import org.example.guide.domain.Guide;
import org.example.guide.persistence.guideMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class guideService {
    @Autowired
    guideMapper guideMapper;
    public List<Guide> showguide(){
        return guideMapper.selectAll();
    }

    public  List<Guide> searchguide(String keyword){
        return guideMapper.selectByName(keyword);
    }

    public  void deleteguide(int id){
        guideMapper.deleteById(id);
    }

    public  void insertguide(Guide guide){
        guideMapper.insert(guide.getId(),guide.getName(),guide.getAge(),guide.getGender(),guide.getPhoneNumber(),guide.getEmail(),guide.getQualification(),guide.getStatus(),guide.getTeamID(),guide.getScore());
    }

    public  void updateguide(Guide guide){
        guideMapper.update(guide.getId(),guide.getName(),guide.getAge(),guide.getGender(),guide.getPhoneNumber(),guide.getEmail(),guide.getQualification(),guide.getStatus(),guide.getTeamID());
    }
    public void updateScore(Guide guide){
        guideMapper.updateScore(guide.getId(),guide.getScore());
    }
}
